# _*_ coding: utf-8 _*_
# @Time : 2024-01-20 19:11
# @Author : wf
# 安装 ： pip install requests

import requests

base_url = 'https://fanyi.baidu.com/v2transapi?from=en&to=zh'

# 路径编码
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
    'Cookie': 'BIDUPSID=9203607446FE9EAD526E9AF1D5C1D8C0; PSTM=1623154582; REALTIME_TRANS_SWITCH=1; SOUND_SPD_SWITCH=1; HISTORY_SWITCH=1; FANYI_WORD_SWITCH=1; SOUND_PREFER_SWITCH=1; BDUSS=NsLXJmSUxxTXRuUjg5czJ1b1NZTkdYTjBHbEg0M2tUNnhaU1lkWlZSRm9iQlJrRVFBQUFBJCQAAAAAAAAAAAEAAADs4A0l0fS54rK70OK1xLCuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjf7GNo3-xjaV; BDUSS_BFESS=NsLXJmSUxxTXRuUjg5czJ1b1NZTkdYTjBHbEg0M2tUNnhaU1lkWlZSRm9iQlJrRVFBQUFBJCQAAAAAAAAAAAEAAADs4A0l0fS54rK70OK1xLCuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjf7GNo3-xjaV; BAIDUID=749C06B51A5989485A1509F85B491C42:SL=0:NR=10:FG=1; MCITY=-131%3A; H_PS_PSSID=39996_39938; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; delPer=0; PSINO=2; BAIDUID_BFESS=749C06B51A5989485A1509F85B491C42:SL=0:NR=10:FG=1; BA_HECTOR=052k2g8k018h2g80048l8485a308861iqnkk11s; ZFY=2:A3zJiw5KUgbaaZDqYWx:APVPlt80B:AxjgNJgiDR0XxY:C; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1705239296,1705327869,1705677708,1705759517; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1705759517; ab_sr=1.0.1_MTA1ZmUzYmIxMGI3NjdmNGRhZGY3Yjk2NzQyMzE0YTdiM2U0OWFlMzQ1NTNmY2Y0NzU4MTEzMmE5ZGQyOGE1MmZlNTE3YmZmNzkzM2U1YjljMDlmZTM0YTAyOTg2ZGY3MjJlNDc3MDMwYmE4MTlhNjkwNDUyNWNmMmEwMTg2OTZkOWRmNTdiZGQwYWM5MTI4MDQzNWY2YTUzZTAwMTYxOTJmNjgyYTM5YjQ4OTIxYzE2NmMzYTEwOTMxNjZmNTlk',
}

data = {
    'from': 'en',
    'to': 'zh',
    'query': 'eye',
    'transtype': 'realtime',
    'simple_means_flag': '3',
    'sign': '67056.386753',
    'token': '0c0d5a129a3fc468070703bba1e2b3d7',
    'domain': 'common',
    'ts': '1705759937679',
}
response = requests.post(base_url, data=data, headers=headers)

response.encoding = 'utf-8'
# print(response.text)

import json

data = json.loads(response.text)
print(data)
